Reports for WinForms | ComponentOne
Working with C1Report / Modifying the Fields / Resetting the Page Counter
In This Topic
    Resetting the Page Counter
    In This Topic

    The C1Report.Page variable is created and automatically updated by the control. It is useful for adding page numbers to page headers or footers. In some cases, you may want to reset the page counter when a group starts. For example, in a report that groups records by country. You can do this by adding code or using the Designer.

    Using Code:

    To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property. Enter the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    C1Report1.Fields("PageFooter").Text = "[ShipCountry] & "" "" & [Page]"
    

    To write code in C#

    C#
    Copy Code
    c1Report1.Fields["PageFooter"].Text = "[ShipCountry] + [Page]";
    

    Using the C1ReportDesigner:

    To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property by completing the following steps:

    1. Select the PageFooter's page number field from the Properties window drop-down list in the Designer or select the field from the design pane. This reveals the field's available properties.
    2. Click the box next to the Text property, then click the drop-down arrow, and select Script Editor from the list.
    3. In the VBScript Editor, simply type the following script in the window: [ShipCountry] & " - Page " & [Page]
    4. Click OK to close the editor.
    See Also